//
// Created by RM UI Designer
//

#include "ui_default_POWER1_0.h"

#define FRAME_ID 0
#define GROUP_ID 4
#define START_ID 0
#define OBJ_NUM 5
#define FRAME_OBJ_NUM 5

CAT(ui_, CAT(FRAME_OBJ_NUM, _frame_t)) ui_default_POWER1_0;
ui_interface_arc_t *ui_default_POWER1_power_50 = (ui_interface_arc_t *)&(ui_default_POWER1_0.data[4]);
ui_interface_arc_t *ui_default_POWER1_power_40 = (ui_interface_arc_t *)&(ui_default_POWER1_0.data[3]);
ui_interface_arc_t *ui_default_POWER1_power_30 = (ui_interface_arc_t *)&(ui_default_POWER1_0.data[2]);
ui_interface_arc_t *ui_default_POWER1_power_20 = (ui_interface_arc_t *)&(ui_default_POWER1_0.data[1]);
ui_interface_arc_t *ui_default_POWER1_power_10 = (ui_interface_arc_t *)&(ui_default_POWER1_0.data[0]);

void _ui_init_default_POWER1_0() {
    for (int i = 0; i < OBJ_NUM; i++) {
        ui_default_POWER1_0.data[i].figure_name[0] = FRAME_ID;
        ui_default_POWER1_0.data[i].figure_name[1] = GROUP_ID;
        ui_default_POWER1_0.data[i].figure_name[2] = i + START_ID;
        ui_default_POWER1_0.data[i].operate_tpyel = 1;
    }
    for (int i = OBJ_NUM; i < FRAME_OBJ_NUM; i++) {
        ui_default_POWER1_0.data[i].operate_tpyel = 0;
    }

    ui_default_POWER1_power_50->figure_tpye = 4;
    ui_default_POWER1_power_50->layer = 2;
    ui_default_POWER1_power_50->rx = 400;
    ui_default_POWER1_power_50->ry = 400;
    ui_default_POWER1_power_50->start_x = 960;
    ui_default_POWER1_power_50->start_y = 540;
    ui_default_POWER1_power_50->color = 1;
    ui_default_POWER1_power_50->width = 7;
    ui_default_POWER1_power_50->start_angle = 270;
    ui_default_POWER1_power_50->end_angle = 279;

    ui_default_POWER1_power_40->figure_tpye = 4;
    ui_default_POWER1_power_40->layer = 2;
    ui_default_POWER1_power_40->rx = 400;
    ui_default_POWER1_power_40->ry = 400;
    ui_default_POWER1_power_40->start_x = 960;
    ui_default_POWER1_power_40->start_y = 540;
    ui_default_POWER1_power_40->color = 1;
    ui_default_POWER1_power_40->width = 7;
    ui_default_POWER1_power_40->start_angle = 279;
    ui_default_POWER1_power_40->end_angle = 288;

    ui_default_POWER1_power_30->figure_tpye = 4;
    ui_default_POWER1_power_30->layer = 2;
    ui_default_POWER1_power_30->rx = 400;
    ui_default_POWER1_power_30->ry = 400;
    ui_default_POWER1_power_30->start_x = 960;
    ui_default_POWER1_power_30->start_y = 540;
    ui_default_POWER1_power_30->color = 1;
    ui_default_POWER1_power_30->width = 7;
    ui_default_POWER1_power_30->start_angle = 288;
    ui_default_POWER1_power_30->end_angle = 297;

    ui_default_POWER1_power_20->figure_tpye = 4;
    ui_default_POWER1_power_20->layer = 2;
    ui_default_POWER1_power_20->rx = 400;
    ui_default_POWER1_power_20->ry = 400;
    ui_default_POWER1_power_20->start_x = 960;
    ui_default_POWER1_power_20->start_y = 540;
    ui_default_POWER1_power_20->color = 1;
    ui_default_POWER1_power_20->width = 7;
    ui_default_POWER1_power_20->start_angle = 297;
    ui_default_POWER1_power_20->end_angle = 306;

    ui_default_POWER1_power_10->figure_tpye = 4;
    ui_default_POWER1_power_10->layer = 2;
    ui_default_POWER1_power_10->rx = 400;
    ui_default_POWER1_power_10->ry = 400;
    ui_default_POWER1_power_10->start_x = 960;
    ui_default_POWER1_power_10->start_y = 540;
    ui_default_POWER1_power_10->color = 1;
    ui_default_POWER1_power_10->width = 7;
    ui_default_POWER1_power_10->start_angle = 306;
    ui_default_POWER1_power_10->end_angle = 315;


    CAT(ui_proc_, CAT(FRAME_OBJ_NUM, _frame))(&ui_default_POWER1_0);
    SEND_MESSAGE((uint8_t *) &ui_default_POWER1_0, sizeof(ui_default_POWER1_0));
}

void _ui_update_default_POWER1_0() {
    for (int i = 0; i < OBJ_NUM; i++) {
        ui_default_POWER1_0.data[i].operate_tpyel = 2;
    }

    CAT(ui_proc_, CAT(FRAME_OBJ_NUM, _frame))(&ui_default_POWER1_0);
    SEND_MESSAGE((uint8_t *) &ui_default_POWER1_0, sizeof(ui_default_POWER1_0));
}

void _ui_remove_default_POWER1_0() {
    for (int i = 0; i < OBJ_NUM; i++) {
        ui_default_POWER1_0.data[i].operate_tpyel = 3;
    }

    CAT(ui_proc_, CAT(FRAME_OBJ_NUM, _frame))(&ui_default_POWER1_0);
    SEND_MESSAGE((uint8_t *) &ui_default_POWER1_0, sizeof(ui_default_POWER1_0));
}


void _ui_power_0(int power){
    if(power >= 5){
        for (int i = 0; i < OBJ_NUM; i++) {
            ui_default_POWER1_0.data[i].operate_tpyel = 1;
        }
    }

        for (int i = OBJ_NUM - 1; i >= power; i--) {
            ui_default_POWER1_0.data[i].operate_tpyel = 3;
        }
        for(int i = power-1; i >= 0 ; i--){
            ui_default_POWER1_0.data[i].operate_tpyel = 1;
        }


    

    CAT(ui_proc_, CAT(FRAME_OBJ_NUM, _frame))(&ui_default_POWER1_0);
    SEND_MESSAGE((uint8_t *) &ui_default_POWER1_0, sizeof(ui_default_POWER1_0));
    SEND_MESSAGE((uint8_t *) &ui_default_POWER1_0, sizeof(ui_default_POWER1_0));
}